package com.wondertek.poms.init.po;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.Proxy;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.wondertek.poms.common.constant.CurrentUser;

import cn.hutool.core.date.DateUtil;
import lombok.Data;

/**
 * <p><b>InitTime Description:</b> InitTime po类 ; 初始化时间表</p>
 * @author 窦再兴1
 * <p><b>DATE</b> 2020-03-30 19:11:50</p>
 */
@Data
@Entity
@Table(name = "init_time")
@DynamicUpdate
@DynamicInsert
@Proxy(lazy = false)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class InitTime implements java.io.Serializable {
	
	/**
	 * <b>Fields</b> serialVersionUID :
	 */
	private static final long serialVersionUID = -3403075050982293835L;

	/**
	 * <b>Fields</b> id : 主键ID
	 */
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Long id;
	
	/**
	 * <b>Fields</b> hour : 小时 1-24，英文逗号分隔
	 */
	private String hour;
	
	/**
	 * <b>Fields</b> week : 星期 1-7，英文逗号分隔
	 */
	private String week;
	
	/**
	 * <b>Fields</b> mouth : 月份 1-12，英文逗号分隔
	 */
	private String mouth;
	
	/**
	 * <b>Fields</b> year : 年 2020
	 */
	private Integer year;
	
	/**
	 * <b>Fields</b> num : 五分钟条数
	 */
	private Integer num;
	
	/**
	 * <b>Fields</b> createdBy : 创建人
	 */
	@Column(name = "created_by")
	private String createdBy;
	
	/**
	 * <b>Fields</b> createdTime : 创建时间
	 */
	@Column(name = "created_time")
	private String createdTime;
	
	/**
	 * <b>Fields</b> updatedBy : 更新人
	 */
	@Column(name = "updated_by")
	private String updatedBy;
	
	/**
	 * <b>Fields</b> updatedTime : 更新时间
	 */
	@Column(name = "updated_time")
	private String updatedTime;
	
	/**
	 * <b>Fields</b> remarks : 备注
	 */
	private String remarks;
	
	/**
	 * <b>Fields</b> del : 是否删除 1:是 0:否
	 */
	private Integer del = 0;
	
	public static void putTimeAndUser(InitTime initTime) {
		if (initTime.id == null) {
			initTime.setCreatedBy(CurrentUser.currUserName());
			initTime.setCreatedTime(DateUtil.formatDateTime(new java.util.Date()));
		}
		initTime.setUpdatedBy(CurrentUser.currUserName());
		initTime.setUpdatedTime(DateUtil.formatDateTime(new java.util.Date()));
	}
}